package org.maggioni.hibernatesandbox.e01basic.dto;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;


@Entity(name="user_details")
public class UserDetails {
	
	@Id
	@GeneratedValue
	@Column(name="user_id")
	private int userId;
	
	@Column(name="user_name")
	private String userName;
	
	@Temporal(TemporalType.DATE)
	private Date joinDate;
	
	@Lob
	private String description;
	
	@Embedded
	@AttributeOverrides({
	@AttributeOverride(name="street",column=@Column(name="home_street")),
	@AttributeOverride(name="city",column=@Column(name="home_city"))
	})
	private Address homeAddress;

	@Embedded
	@AttributeOverrides({
	@AttributeOverride(name="street",column=@Column(name="office_street")),
	@AttributeOverride(name="city",column=@Column(name="office_city"))
	})
	private Address officeAddress;

	@Transient
	private String doNotPersist;
	
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public Date getJoinDate() {
		return joinDate;
	}
	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getDoNotPersist() {
		return doNotPersist;
	}
	public void setDoNotPersist(String doNotPersist) {
		this.doNotPersist = doNotPersist;
	}
	public Address getHomeAddress() {
		return homeAddress;
	}
	public void setHomeAddress(Address homeAddress) {
		this.homeAddress = homeAddress;
	}
	public Address getOfficeAddress() {
		return officeAddress;
	}
	public void setOfficeAddress(Address officeAddress) {
		this.officeAddress = officeAddress;
	}
	@Override
	public String toString() {
		return "UserDetails [userId=" + userId + ", userName=" + userName
				+ ", joinDate=" + joinDate + ", description=" + description
				+ ", homeAddress=" + homeAddress + ", officeAddress="
				+ officeAddress + ", doNotPersist=" + doNotPersist + "]";
	}


	
	
	
}
